$(function () {
    initMovieRecommendTool(); //建立Movie管理对象
    $("#movie_recommend").datagrid({
        url: '/Recommend/recommend',
        type: 'POST',
        queryParams: {
            "csrfmiddlewaretoken": $('input[name="csrfmiddlewaretoken"]').val()
        },
        fit: true,
        fitColumns: true,
        striped: true,
        rownumbers: true,
        pageNumber: 1,
        sortName: "movieId",
        sortOrder: "desc",
        toolbar: "#movie_recommend_tool",
        columns: [[
            {
                field: "title",
                title: "影片名称",
                width: 200,
            },
            {
                field: "genres",
                title: "影片体裁",
                width: 100,
            },
            {
                field: "movieYear",
                title: "上映年份",
                width: 40,
            },
            {
                field: "movieDesc",
                title: "影片简介",
                width: 200,
            },
        ]],
    });
});

function initMovieRecommendTool() {
    movie_recommend_tool = {
        reload: function () {
            $("#movie_recommend").datagrid("reload");
        },
    };
}
